| Conditions | 2 |
| Total Lines | 10 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { useState, useEffect } from "react"; |
||
| 2 | |||
| 3 | function useToastFunction(toastRef) { |
||
| 4 | const [toast, setToast] = useState(null); |
||
| 5 | useEffect(() => { |
||
| 6 | if (toastRef.current && toastRef.current.toast) { |
||
| 7 | setToast(() => toastRef.current.toast); |
||
| 8 | } |
||
| 9 | // eslint-disable-next-line react-hooks/exhaustive-deps |
||
| 10 | }, [toastRef, toastRef.current]); |
||
| 11 | return toast; |
||
| 12 | } |
||
| 14 | export default useToastFunction; |